From: River Tarnell Date: Mon, 30 Jul 2007 01:56:37 +0000 (+0000) Subject: - new field: page_key, stores page_title in uppercase. X-Git-Tag: 1.31.0-rc.0~51932 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=f77ea104b5df9f691bfcbe754a87426121948e13;p=lhc%2Fweb%2Fwiklou.git - new field: page_key, stores page_title in uppercase. schema change, maintenance script included --- diff --git a/includes/Article.php b/includes/Article.php index 48422f558a..2595299c5e 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -262,6 +262,7 @@ class Article { 'page_id', 'page_namespace', 'page_title', + 'page_key', 'page_restrictions', 'page_counter', 'page_is_redirect', @@ -1001,6 +1002,7 @@ class Article { * @private */ function insertOn( $dbw ) { + global $wgContLang; wfProfileIn( __METHOD__ ); $page_id = $dbw->nextSequenceValue( 'page_page_id_seq' ); @@ -1008,6 +1010,7 @@ class Article { 'page_id' => $page_id, 'page_namespace' => $this->mTitle->getNamespace(), 'page_title' => $this->mTitle->getDBkey(), + 'page_key' => $wgContLang->caseFold($this->mTitle->getDBkey()), 'page_counter' => 0, 'page_restrictions' => '', 'page_is_redirect' => 0, # Will set this shortly... diff --git a/includes/Title.php b/includes/Title.php index 7a459bd618..338fc0fb87 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2126,7 +2126,7 @@ class Title { * be a redirect */ private function moveOverExistingRedirect( &$nt, $reason = '' ) { - global $wgUseSquid; + global $wgUseSquid, $wgContLang; $fname = 'Title::moveOverExistingRedirect'; $comment = wfMsgForContent( '1movedto2_redir', $this->getPrefixedText(), $nt->getPrefixedText() ); @@ -2156,6 +2156,7 @@ class Title { 'page_touched' => $dbw->timestamp($now), 'page_namespace' => $nt->getNamespace(), 'page_title' => $nt->getDBkey(), + 'page_key' => $wgContLang->caseFold($nt->getDBkey()), 'page_latest' => $nullRevId, ), /* WHERE */ array( 'page_id' => $oldid ), @@ -2203,7 +2204,7 @@ class Title { * @param Title &$nt the new Title */ private function moveToNewTitle( &$nt, $reason = '' ) { - global $wgUseSquid; + global $wgUseSquid, $wgContLang; $fname = 'MovePageForm::moveToNewTitle'; $comment = wfMsgForContent( '1movedto2', $this->getPrefixedText(), $nt->getPrefixedText() ); if ( $reason ) { @@ -2226,6 +2227,7 @@ class Title { 'page_touched' => $now, 'page_namespace' => $nt->getNamespace(), 'page_title' => $nt->getDBkey(), + 'page_key' => $wgContLang->caseFold($nt->getDBkey()), 'page_latest' => $nullRevId, ), /* WHERE */ array( 'page_id' => $oldid ), diff --git a/maintenance/tables.sql b/maintenance/tables.sql index e9d6afbbdd..fb4ac46f22 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -190,6 +190,9 @@ CREATE TABLE /*$wgDBprefix*/page ( -- Spaces are transformed into underscores in title storage. page_title varchar(255) binary NOT NULL, + -- page_title in uppercase. Used for case-insensitive title searching. + page_key varchar(255) binary NOT NULL, + -- Comma-separated set of permission keys indicating who -- can move or edit the page. page_restrictions tinyblob NOT NULL, diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 2b04740e65..9391fc20b4 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -82,6 +82,7 @@ $wgNewFields = array( array( 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql'), array( 'archive', 'ar_page', 'patch-archive-ar_page.sql'), array( 'image', 'img_sha1', 'patch-img_sha1.sql' ), + array( 'page', 'page_key', 'patch-page_key.sql' ), ); # For extensions only, should be populated via hooks